package cn.iocoder.an.module.business.dal.mysql.mangeid;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.business.dal.dataobject.mangeid.MangeIdDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.business.controller.admin.mangeid.vo.*;

/**
 * 产品ID管理 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface MangeIdMapper extends BaseMapperX<MangeIdDO> {

    default List<MangeIdDO> selectList(MangeIdListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MangeIdDO>()
                .likeIfPresent(MangeIdDO::getName, reqVO.getName())
                .betweenIfPresent(MangeIdDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MangeIdDO::getId));
    }

	default MangeIdDO selectByParentIdAndName(Long parentId, String name) {
	    return selectOne(MangeIdDO::getParentId, parentId, MangeIdDO::getName, name);
	}

    default Long selectCountByParentId(Long parentId) {
        return selectCount(MangeIdDO::getParentId, parentId);
    }

}